<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ page import="cn.hit.edu.switter.DatabaseHelper"%>
<%@ page import="java.util.ArrayList"%>
<%@ page import="cn.hit.edu.switter.Message" %>
<%@ page import="cn.hit.edu.switter.Account" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%
	int id = Integer.parseInt(request.getParameter("Id"));
	int UserId = (Integer)session.getAttribute("UserId");
	
	DatabaseHelper db = new DatabaseHelper();
	Account a = db.fetchAccount(id);
	
	String avatarPath = a.getPicName();
	String name = a.getNickname();
%> 
<html xmlns="http://www.w3.org/1999/xhtml">

<head>

 <link rel="stylesheet" href="base.css" type="text/css" media="screen" charset="utf-8" /><style type="text/css">body { background-color:#E9F0DB; background-image:url(http://static.fanfou.com/img/bg/17.png); background-repeat:repeat; background-position:top left; color:#8D7947;}a, #sidebar a:hover, .pagination .more:hover, .stamp a:hover, .light .stamp a { color:#AF838C;}a:hover, .light .stamp .reply a { background-color:#AF838C;}a:hover .label, a.photo:hover img, .stamp a:hover, .light .stamp a { border-color:#AF838C;}.actions .open-notice:hover { color:#AF838C;}#sidebar { background-color:#F4F8ED; border-left:1px solid #CEDDC2;}#sidebar .sect { border-top-color:#CEDDC2;}#sidebar .stabs { border-bottom-color:#CEDDC2;}#sidebar .stabs li.current a { color:#8D7947;}#user_stats li { border-left-color:#CEDDC2;}#user_stats .count { color:#8D7947;}#user_stats a:hover .count { color:#AF838C;}#goodapp span { color:#8D7947;}</style><link rel="alternate" type="application/rss+xml" title="johnnyxia_饭否" href="http://api.fanfou.com/statuses/user_timeline/johnnyxia.rss" /> 
<title></title> 
<meta name="description" content=" " /><meta name="author" content="JohnnyXia(johnnyxia)" /> 
</head> 
<body> 
<div id="container" class="newlook"> 
<div id="header"> 
	<h1><a href=""><img src="RESOURCE/switter.png" alt="Switter" /><span>首页</span></a></h1> 
	<div id="navigation" class="ui-roundedbox"><div class="ui-roundedbox-corner ui-roundedbox-tl"><div class="ui-roundedbox-corner ui-roundedbox-tr"><div class="ui-roundedbox-corner ui-roundedbox-bl"><div class="ui-roundedbox-corner ui-roundedbox-br"><div class="ui-roundedbox-content"> 
		<ul> 
			<li><a href="index.jsp">首页</a></li> 
			<li><a href="home.jsp?Id=<%=UserId %>">我的空间</a></li> 
			<li><a href="browse.jsp">随便看看</a></li> 
		
			<li><a href="/Switter_beta/settings.jsp">设置</a></li> 
			<li><a href="/Switter_beta/logout">退出</a></li> 
		</ul> 
	</div></div></div></div></div></div> 
</div> 
<table id="columns"> 
	<tr> 
		<td id="main"> 
			<div id="info"> 
				<div id="avatar"><a href="/settings" title="更新头像">
					<img src="/Switter_beta/Avatars/<%= avatarPath %>" alt="<%=name %>" /></a></div>
		<div id="panel">
		<h1><%=name %></h1>
		<% if ( !db.IsFriend(id, UserId)) {
		%>
		<a href="/Switter_beta/AddFriend?Fid=<%=id %>&UserId=<%=UserId %>" class="post_act bh" token="2933d74f">关注此人</a>
		
		<%
		}
		%>
		</div>
		</div>

		<div id="content"> 
					<div id="stream" class="message">
					<ol>
					<% 
			
			ArrayList<Message> msg = db.fetchMessages(id, 10);
			
			if (msg != null) {
			for (int i = 0; i < msg.size(); i++) {
				String details = msg.get(i).getMsg();
				String postTime = msg.get(i).getPostTime().toLocaleString();
		%>
			<li><span class="content"><%= details %></span> 
					<span class="stamp">
					<a href="" class="time" title="" ffid="43SZXRMUWqQ" stime="<%=postTime %>"><%=postTime %></a>
					<a href="" class="post_act share" title="添加到我的收藏" token="168912a8">收藏</a>
					</span>
					</li>
		<%
		}
			
			}
		%>
					
					</ol>
					</div>	
					</div> 
					</td> 
		<td id="sidebar"> 
			<div id="iconset"><img src="RESOURCE/ico-email-gmail.png" alt="已验证 email" title="已验证 email" />
			</div>
			<div id="user_infos"> 
				<ul class="vcard">
					<li class="adr">所在地：<span class="region"><a href="/search?pr=31">黑龙江</a> <a href="/search?ci=3101">哈尔滨</a></span></li>
					<li class="collapse">性别：男</li><li class="collapse">生日：1992 年 1 月 30 日</li>
					<li class="collapse">家乡：<span>安徽 马鞍山</span></li>
				</ul>
			</div> 
			<!-- 
			<ul id="user_stats">
				<li><a href="/friends/johnnyxia"><span class="count">2</span> <span class="label">他关注的人</span></a></li>
				<li><a href="/followers/johnnyxia"><span class="count">1</span> <span class="label">关注他的人</span></a></li>
				<li><a href="/johnnyxia"><span class="count">1</span> <span class="label">消息</span></a></li></ul><div class="stabs"><ul><li class="current"><a href="/johnnyxia"><span class="label">消息</span> <span class="count">(1)</span></a></li> 
				<li><a href="/favorites/johnnyxia"><span class="label">收藏</span> <span class="count">(0)</span></a></li> 
				<li><a href="/album/johnnyxia"><span class="label">照片</span> <span class="count">(0)</span></a></li> 
			</ul>
			 -->
			<div id="friends"> 
				<h2>JohnnyXia关注的人</h2> 
					<ul class="alist">
					<%
						ArrayList<Integer> friends = db.fetchFriends(id);
						for (int i = 0; i < friends.size(); i++) {
							int fid = friends.get(i);
							
							Account acc = db.fetchAccount(fid);
							if (acc != null) {
							String picName = acc.getPicName();
							String nickname = acc.getNickname();
					%>
					<li><a href="/Switter_beta/home.jsp?Id=<%=fid %>" title="<%= nickname%>">
					<img src="/Switter_beta/Avatars/<%=picName %>" alt="<%=nickname %>" /><span><%=nickname %></span></a></li>
					<%
							}
						}
					%>
					</ul>	
					</div> 
			<div class="sect"> 
				<p class="rssfeed"><a href="http://api.fanfou.com/statuses/user_timeline/johnnyxia.rss" title="订阅JohnnyXia的消息" target="_blank">订阅JohnnyXia的消息</a></p> 
			</div> 
			<div class="sect"> 
				<div class="user-op"> 
							</div> 
			</div> 
		</td> 
	</tr> 
</table> 

</div> 
</body> 
</html> 